import { createRouter, createWebHashHistory } from 'vue-router'
const recommendView = () => import('../views/recommendView' /* webpackChunkName: "recommend" */)
const singerView = () => import('../views/singerView' /* webpackChunkName: "singerView" */)
const searchView = () => import('../views/searchView' /* webpackChunkName: "searchView" */)
const topListView = () => import('../views/top-listView' /* webpackChunkName: "top-listView" */)
const SingerDetail = () => import('../views/singer-detail' /* webpackChunkName: "singer-detail" */)
const Album = () => import('../views/album' /* webpackChunkName: "album" */)
const UserCenter = () => import('../views/user-center' /* webpackChunkName: "user-center" */)
const TopDetail = () => import('../views/top-detail' /* webpackChunkName: "top-detail" */)
const routes = [
  {
    path: '/',
    redirect: '/recommend'
  },
  {
    path: '/recommend',
    name: 'recommendView',
    component: recommendView,
    children: [
      {
        path: ':id',
        component:Album
      }
    ]
  }, {
    path: '/singer',
    name: 'singerView',
    component: singerView,
    children: [
      {
        path: ':id',
        component: SingerDetail
      }
    ]
  }, {
    path: '/search',
    name: 'searchView',
    component: searchView,
    children: [
      {
        path: ':id',
        component: SingerDetail
      }
    ]
  }, {
    path: '/toplist',
    name: 'topListView',
    component: topListView,
    children: [
      {
        path:':id',
        component: TopDetail
      }
    ]
  }, {
    path: '/user',
    components: {
      user: UserCenter
    } 
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
